package com.example.superoa.model.service;

import java.util.List;
import java.util.Optional;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.alibaba.fastjson.JSONArray;
import com.example.superoa.model.dao.RsapDao;
import com.example.superoa.model.mappers.RapsMapper;
import com.example.superoa.model.mappers.StaffMapper;
import com.example.superoa.model.pojos.Rsap;
import com.example.superoa.model.pojos.Staff;
import com.example.superoa.model.vo.RsapsVo;

@Service
@Transactional(rollbackFor=Exception.class)
public class RsapsService {
	@Autowired
	private RapsMapper rapsmapper;
	
	@Autowired
	private StaffMapper staffmapper;
	
	@Autowired
	private RsapDao rsapsdao;
	
	//查询奖惩信息
	public List<RsapsVo> selectrsapas(){
		return rapsmapper.selectrsapas();
	}
	
	//新增奖惩信息
	public void addrsaps(Rsap rsa,Staff s) {
		rsapsdao.save(rsa);
	}
	public Staff staffasssId(String staff_name) {
		return staffmapper.staffasssId(staff_name);
	}
	
	//条件查询
	public JSONArray selelikeke(String staff_name) {
		JSONArray array =rapsmapper.selectlikersaps(staff_name);
		return array;
	}
	//根据id查询奖惩信息
	public JSONArray rsapsById(int rsaps_id) {
		return rapsmapper.rsapsById(rsaps_id);
	}
	//根据id编辑
	public void rsapsbjById(Rsap s) {
		//return rsapsdao.findById(id);
	}
}
